import 'package:flutter_base/common/utils/screen.dart';
import 'package:flutter_base/common/utils/utils.dart';
import 'package:flutter_base/common/widgets/widgets.dart';
import 'package:flutter_base/common/widgets/ztbAppbar.dart';
import 'package:flutter_base/pages/home/entitys/entrys.dart';
import 'package:flutter/material.dart';

class CooperationPage extends StatefulWidget {
  @override
  _CooperationPageState createState() => _CooperationPageState();
}

class _CooperationPageState extends State<CooperationPage> {
  List<EntryEntity> _list = [
    EntryEntity(
        title: '会议信息',
        color: Color(0xfff4a040),
        icon: Icon(
          Iconfont.huiyixinxi,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '定期信息',
        color: Color(0xff4f95ed),
        icon: Icon(
          Iconfont.dingqixinxi,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '专项工作',
        color: Color(0xff57b988),
        icon: Icon(
          Iconfont.zhuanxiang,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '督办',
        color: Color(0xffdf604d),
        icon: Icon(
          Iconfont.duban,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '云盘',
        color: Color(0xff4f95ed),
        icon: Icon(
          Iconfont.cloud,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '邮箱',
        color: Color(0xffdf604d),
        icon: Icon(
          Iconfont.email,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '报告',
        color: Color(0xfff4a040),
        icon: Icon(
          Iconfont.baogao,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '图片视频',
        color: Color(0xff57b988),
        icon: Icon(
          Iconfont.live,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    // EntryEntity(
    //     title: '邮箱',
    //     color: Color(0xffdf604d),
    //     icon: Icon(
    //       Iconfont.email,
    //       size: zhiSetWidth(18),
    //       color: Colors.white,
    //     )),
    // EntryEntity(
    //     title: '直播',
    //     color: Color(0xffee8430),
    //     icon: Icon(
    //       Iconfont.live,
    //       size: zhiSetWidth(18),
    //       color: Colors.white,
    //     )),
    // EntryEntity(
    //     title: '视频会议',
    //     color: Color(0xff57b988),
    //     icon: Icon(
    //       Iconfont.shipintonghua,
    //       size: zhiSetWidth(18),
    //       color: Colors.white,
    //     )),
  ];
  List<EntryEntity> _list1 = [
    EntryEntity(
        title: '审计报告',
        color: Color(0xff4f95ed),
        icon: Icon(
          Iconfont.shenjibaogao,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
  ];
  List<EntryEntity> _list2 = [
    EntryEntity(
        title: '公众号',
        color: Color(0xff4f95ed),
        icon: Icon(
          Iconfont.gongzhonghao,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '公司公众号',
        color: Color(0xff57b988),
        icon: Icon(
          Iconfont.gongsi,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '专项公众号',
        color: Color(0xffdf604d),
        icon: Icon(
          Iconfont.zhuanxiang,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
    EntryEntity(
        title: '视频公众号',
        color: Color(0xfff4a040),
        icon: Icon(
          Iconfont.shipin,
          size: zhiSetWidth(18),
          color: Colors.white,
        )),
  ];

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // backgroundColor: Colors.white,
      appBar: ZtbAppBar(
        title: '协作',
        isBack: false,
      ),
      body: SafeArea(
        child: SingleChildScrollView(
          child: Column(
            children: [
              Container(
                child: SingleChildScrollView(
                  child: Column(
                    children: [
                      Container(
                        margin: EdgeInsets.fromLTRB(zhiSetWidth(10), 15, zhiSetWidth(10), 15),
                        //边框设置
                        decoration: new BoxDecoration(
                          //背景
                          color: Colors.white,
                          //设置四周圆角 角度
                          borderRadius: BorderRadius.all(Radius.circular(4.0)),
                        ),
                        padding: EdgeInsets.fromLTRB(zhiSetWidth(10), 15, zhiSetWidth(10), 15),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Padding(
                              padding: EdgeInsets.fromLTRB(zhiSetWidth(8), 0, 0, zhiSetHeight(12)),
                              child: Text(
                                '全员协作',
                                style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
                              ),
                            ),
                            Wrap(
                              crossAxisAlignment: WrapCrossAlignment.start,
                              alignment: WrapAlignment.start,
                              spacing: 0,
                              //主轴上子控件的间距
                              runSpacing: 20,
                              //交叉轴上子控件之间的间距
                              children: _entryWidget(context, _list),
                            )
                          ],
                        ),
                      ),
                      Container(
                        margin: EdgeInsets.fromLTRB(zhiSetWidth(10), 0, zhiSetWidth(10), 15),
                        //边框设置
                        decoration: new BoxDecoration(
                          //背景
                          color: Colors.white,
                          //设置四周圆角 角度
                          borderRadius: BorderRadius.all(Radius.circular(4.0)),
                        ),
                        padding: EdgeInsets.fromLTRB(zhiSetWidth(10), 15, zhiSetWidth(10), 15),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Padding(
                              padding: EdgeInsets.fromLTRB(zhiSetWidth(8), 0, 0, zhiSetHeight(12)),
                              child: Text(
                                '部门协作',
                                style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
                              ),
                            ),
                            FractionallySizedBox(
                              widthFactor: 1,
                              child: Wrap(
                                crossAxisAlignment: WrapCrossAlignment.start,
                                alignment: WrapAlignment.start,
                                spacing: 0,
                                //主轴上子控件的间距
                                runSpacing: 20,
                                //交叉轴上子控件之间的间距
                                children: _entryWidget(context, _list1),
                              ),
                            )
                          ],
                        ),
                      ),
                      Container(
                        margin: EdgeInsets.fromLTRB(zhiSetWidth(10), 0, zhiSetWidth(10), 15),
                        //边框设置
                        decoration: new BoxDecoration(
                          //背景
                          color: Colors.white,
                          //设置四周圆角 角度
                          borderRadius: BorderRadius.all(Radius.circular(4.0)),
                        ),
                        padding: EdgeInsets.fromLTRB(zhiSetWidth(10), 15, zhiSetWidth(10), 15),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Padding(
                              padding: EdgeInsets.fromLTRB(zhiSetWidth(8), 0, 0, zhiSetHeight(12)),
                              child: Text(
                                '新媒体',
                                style: TextStyle(fontWeight: FontWeight.w500, fontSize: 20),
                              ),
                            ),
                            FractionallySizedBox(
                              widthFactor: 1,
                              child: Wrap(
                                crossAxisAlignment: WrapCrossAlignment.start,
                                alignment: WrapAlignment.start,
                                spacing: 0,
                                //主轴上子控件的间距
                                runSpacing: 20,
                                //交叉轴上子控件之间的间距
                                children: _entryWidget(context, _list2),
                              ),
                            )
                          ],
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }

  _entryWidget(BuildContext context, list) {
    if (list == null) return null;
    List<Widget> items = [];
    list?.forEach((EntryEntity item) {
      items.add(Container(
        width: MediaQuery.of(context).size.width / 5 - zhiSetWidth(8),
        child: Column(
          children: <Widget>[
            Stack(
              alignment: Alignment.center,
              children: [
                Container(
                  decoration: new BoxDecoration(
                    //背景
                    color: item.color,
                    //设置四周圆角 角度
                    borderRadius: BorderRadius.all(Radius.circular(6.0)),
                  ),
                  width: 40,
                  height: 40,
                ),
                Center(
                  child: item.icon,
                ),
              ],
            ),
            SizedBox(
              height: 5,
            ),
            Text(
              item.title,
              style: TextStyle(fontSize: 12, color: Colors.grey[700]),
            )
          ],
        ),
      ));
    });

    return items;
  }
}
